<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<body>
  <p>1</p>
  <p>2</p>
  <p>3</p>
  <script>
    //1.数组去重
    console.log([...new Set([1,2,1])]);
    //2.字符串去重
    console.log([...new Set('abab')].join(''));
    //3.存放DOM元素
    const s=new Set(document.querySelectorAll('p'))
    s.forEach(elem=>{
      elem.style.color='red'
      elem.style.backgroundColor='blue'
    })
  </script>
</body>
</html>